<template>
  <div class="app-container">
    <div class="head-container">
      <!-- 搜索 -->
      <el-input
        v-model="query.userId"
        clearable
        size="small"
        placeholder="请输入用户ID"
        style="width: 200px;"
        class="filter-item"
      />
      <el-input
        v-model="query.phone"
        clearable
        size="small"
        placeholder="请输入手机号"
        style="width: 200px;"
        class="filter-item"
      />
      <rrOperation />
    </div>
    <div class="tableUp">
      <div class="btnContain">
        <el-button @click="crud.doExport">下载</el-button>
      </div>
    </div>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" border :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table-column :show-overflow-tooltip="true" prop="userId" label="用户ID">
        <!-- <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.id: '' }}
        </template> -->
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="phone" label="手机号">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.phone: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="username" label="用户名">
        <template slot-scope="scope">
          {{ scope.row.user?scope.row.user.username: '' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" label="邀请人">
        <template slot-scope="scope">
          {{ scope.row.userInvitation?scope.row.userInvitation.invitationCode: '--' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="mediaPlatform" label="媒体平台" />
      <el-table-column :show-overflow-tooltip="true" prop="accountId" label="账号ID" />
      <el-table-column :show-overflow-tooltip="true" prop="accountName" label="账号名称" />
      <el-table-column :show-overflow-tooltip="true" prop="followersCount" label="粉丝数" />
      <el-table-column :show-overflow-tooltip="true" prop="accountType" label="账户类型" />
      <el-table-column label="启用状态" align="center" prop="enabled">
        <template slot-scope="scope">
          {{ scope.row.enabled?'启用':'禁用' }}
        </template>
      </el-table-column>
      <el-table-column :show-overflow-tooltip="true" prop="createdAt" width="135" label="注册时间" />
    </el-table>
    <!--分页组件-->
    <div class="pagination">
      <pagination />
    </div>
  </div>
</template>

<script>
import crudAccount from '@/api/system/number'

import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'

export default {
  name: 'Account',
  components: { rrOperation, pagination },
  cruds() {
    return CRUD({ title: '账号', url: 'api/userAccount', crudMethod: { ...crudAccount }})
  },
  mixins: [presenter(), header(), crud()],
  data() {
    return {
      height: document.documentElement.clientHeight - 180 + 'px;'
    }
  },

  created() {
  },
  mounted: function() {
    const that = this
    window.onresize = function temp() {
      that.height = document.documentElement.clientHeight - 180 + 'px;'
    }
  },
  methods: {

  }
}
</script>

  <style rel="stylesheet/scss" lang="scss" scoped>
 .tableUp {
        display: flex;
        margin-bottom: 10px;
        justify-content: flex-end;
        .btnContain {
          ::v-deep .el-button {
          background-color: rgba(236, 91, 91, 1);
          color: #fff;
          border: 0;
        }
        }
      }
  </style>

